package lesson3;

public class Task8 {

		public static void main(String[] args) {
			
			
			int M = 2;
			int N = 4;
			int L = 20;
			
			int counter = 0;
			
			for(int i = 0; i <= L; i+=M)
			{
				for(int j = 0; j <= L; j+=N)
				{
					if(i == j)
					{
						counter++;
					}
				}
			}
			
			//a better way:
			
			
			for(int i = 0; i <=L; i+=N)
			{
				if(i == 0) 
					counter++;
				
				if(i%M == 0)
				{
					counter++;
				}
			}
			
			
		}
}
